package com.theme.passport.controller.trade;

import com.theme.common.mvc.utils.PageUtils;
import com.theme.common.mvc.view.R;
import com.theme.passport.entity.theme.TradeCollectEntity;
import com.theme.passport.service.theme.TradeCollectService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;


/**
 * 用户内购订单记录
 *
 * @author live
 * @email 870459550@qq.com
 * @date 2023-02-22 08:48:28
 */
@RestController
@RequestMapping("trade/trade-collect")
public class TradeCollectController {
    @Autowired
    private TradeCollectService tradeCollectService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("trade:trade-collect:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = tradeCollectService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("trade:trade-collect:info")
    public R info(@PathVariable("id") Long id){
        TradeCollectEntity tabUserPayOrder = tradeCollectService.getById(id);

        return R.ok().put("tradeCollect", tabUserPayOrder);
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("trade:trade-collect:delete")
    public R delete(@RequestBody Long[] ids){
        tradeCollectService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
